	package com.noassertions.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;

//TODO: implement serializable
@Entity
public class User implements Serializable
{
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private int userid; 
	@Column(nullable=false)
	private String firstname;
	@Column(nullable=false)
	private String lastname;
	@Column(nullable=false)
	private Date accountcreationdate;
	@Column(nullable=false)
	private String emailaddress;
	@Column(nullable=false)
	private String password;
	@Column(nullable=false)
	private Date birthdate;
	@Column(nullable=false)
	private Boolean completeprofile;
	
	// One to one relationship with shared primary keys	
	@OneToOne
    @PrimaryKeyJoinColumn
	private Rider rider;
	
	@OneToMany(mappedBy="userid", cascade = CascadeType.ALL)
	private Set<Fit> fits = new HashSet();
	
	public int getUserid() {
		return userid;
	}
	public String getFirstname() {
		return firstname;
	}
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}
	public String getLastname() {
		return lastname;
	}
	public void setLastname(String lastname) {
		this.lastname = lastname;
	}
	public Date getAccountcreationdate() {
		return accountcreationdate;
	}
	public void setAccountcreationdate(Date accountcreationdate) {
		this.accountcreationdate = accountcreationdate;
	}
	public String getEmailaddress() {
		return emailaddress;
	}
	public void setEmailaddress(String emailaddress) {
		this.emailaddress = emailaddress;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public void setBirthdate(Date birthdate) {
		this.birthdate = birthdate;
	}
	public Date getBirthdate() {
		return birthdate;
	}
	public void setCompleteprofile(Boolean completeprofile) {
		this.completeprofile = completeprofile;
	}
	public Boolean getCompleteprofile() {
		return completeprofile;
	}
	public void setRider(Rider rider) {
		this.rider = rider;
	}
	public Rider getRider() {
		return rider;
	}
}